package printing;

public class Printer implements IMachine {
	

	private String modelNumber;
	private PaperTray paperTray = new PaperTray();
	private Machine machine;
	
	public Printer(boolean isOn, String model){
		machine = new Machine(isOn);
		this.modelNumber = model;
	}	
	
	@Override
	public void turnOn() {	
		System.out.println("Warming the print engine");	
	}



	public void print(int copies, String textToPrint){
		
		while (copies > 0 && !paperTray.isEmpty()) {
			System.out.println(textToPrint);
			copies--;	
			paperTray.usePages();
		}
		
		if (paperTray.isEmpty()) {
			System.out.println("Load more paper!");
		}
	}
	
	public void printColors(){
		String[] colors = new String[] {"Red", "Blue", "Green", "Yellow", "Black", "White", "Orange"};
		
		for (String currentColor : colors) {
			
			if ("Green".endsWith(currentColor)) {
				continue;
			}
			System.out.println(currentColor);
		}
		
	}

	public void loadPaper(int count) {
		paperTray.addPages(count);
	}

	@Override
	public void turnOff() {
		System.out.println("The printer is OFF!");
		
	}

	@Override
	public boolean isOn() {
		return machine.isOn;
	}

}
